#include <bits/stdc++.h>

#define ll long long
#define ull unsigned long long
#define uint unsigned int

#define YES cout << "YES" << '\n'
#define NO cout << "NO" << '\n'
#define endl '\n'
const int INF = 1e9;
const int MOD = 998244353;
using namespace std;

/*思考

*/
struct PS {
    ll P, S;
    ll full;
    ll half;
};
vector<PS> forts(1005);
int main() {
    ios::sync_with_stdio(0);
    cin.tie(0);
    ll N, B, cnt = 0, maxcnt = 0;
    cin >> N >> B;
    for (int i = 0; i < N; i++) {
        cin >> forts[i].P >> forts[i].S;
        forts[i].full = forts[i].P + forts[i].S;
        forts[i].half = forts[i].P / 2 + forts[i].S;
    }
    for (int halfidx = 0; halfidx < N; halfidx++) {
        vector<ll> cost;
        cost.emplace_back(forts[halfidx].half);
        for (int i = 0; i < N; i++) {
            if (i != halfidx) {
                cost.emplace_back(forts[i].full);
            }
        }
        sort(cost.begin(), cost.end());
        ll temp = B;
        for (ll c : cost) {
            if (temp >= c) {
                temp -= c;
                cnt++;
            } else
                break;
        }
        maxcnt = max(maxcnt, cnt);
        cnt=0;
    }
    cout << maxcnt << endl;
    return 0;
}